{extend name="base/index"/}
{block name="page_location"}{/block}
{block name="body"}
<div class="row">
	<div class="col-12">
		<div class="page-title-box">
			<div class="page-title-right">
				<ol class="breadcrumb m-0">
					<li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
					<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>商品栏目管理</li>
				</ol>
			</div>
			<h4 class="page-title">
				所有商城分类
				<a href="javascript:;" class="btn btn-success btn-sm ml-3" data-toggle="modal" data-target="#new_box" id="add_goodsclass_btn">创建新的产品分类</a>
			</h4>
		</div>
	</div>
</div>
<div class="row" id="goodsclass_page">
	<div class="col-12">
		<div class="card">
			<div class="card-body">
				<form class="form-inline" style="margin-bottom:10px;">
					<div class="input-group">
						<div class="input-group-prepend">
							<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
							 aria-expanded="false">选择</button>
							<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
								<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="all" attr-bind="check_id">全选</a>
								<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="reverse" attr-bind="check_id">反选</a>
								<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="cancel" attr-bind="check_id">取消</a>
							</div>
						</div>
						<div class="input-group-prepend">
							<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
							 aria-expanded="false">操作选中的</button>
							<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
								<a href="javascript:;" class="dropdown-item Fast_Bat" attr-type="enable" attr-model="goodsclass" attr-class=".check_id">启用</a>
								<a href="javascript:;" class="dropdown-item Fast_Bat" attr-type="disable" attr-model="goodsclass" attr-class=".check_id">禁用</a>
								<a href="javascript:;" class="dropdown-item Fast_Bat" attr-type="del" attr-model="goodsclass" attr-class=".check_id">删除</a>
							</div>
						</div>
						<a href="javascript:;" class="btn btn-primary" id="Fast_Sort" attr-model="goodsclass" attr-frm="goodsclass_list_frm">更新排序</a>
					</div>
				</form>
				<div class="table-responsive-lg">
				<form action="" id="goodsclass_list_frm" method="post">
					<table class="table table-hover">
						<thead>
							<tr>
								<th>选择ID</th>
								<th>名称</th>
								<th>排序</th>
								<th>状态</th>
								<th>导航显示</th>
								<th>更新时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							{volist name='list' id="data"}
							<tr>
								<td>
									<div class="custom-control custom-checkbox">
										<input type="checkbox" class="custom-control-input check_id" id="check_id{$data.id}" value="{$data.id}" name="check_id[]">
										<label class="custom-control-label" for="check_id{$data.id}">ID:{$data.id}</label>
									</div>
								</td>
								<td>
									<span class="subtype_indent">{$data.classname_indent}</span>
									<a href="{:url('goods/index')}?cid={$data.id}">{$data.classname}【ID:{$data.id}】</a>
									<a href="{:url('goods/publish')}?cid={$data.id}" class="badge badge-primary">发布商品</a>
								</td>
								<td>
									<input type="hidden" name="field_ids[]" value="{$data.id}" />
									<input type="number" class="form-control orderid_ipt" name="orderid_ipt[]" value="{$data.orderid}">
								</td>
								<td>
									{eq name="data.status" value="0"}
									<a href="javascript:;" attr-model="goodsclass" attr-id="{$data.id}" attr-field="status" attr-val="1" class="badge badge-primary Fast_Action">启用</a>
									{else /}
									<a href="javascript:;" attr-model="goodsclass" attr-id="{$data.id}" attr-field="status" attr-val="0" class="badge badge-secondary Fast_Action">禁用</a>
									{/eq}
								</td>
								<td>
									{eq name="data.isnav" value="0"}
									<a href="javascript:;" attr-model="goodsclass" attr-id="{$data.id}" attr-field="isnav" attr-val="1"  class="badge badge-primary Fast_Action">启用</a>
									{else /}
									<a href="javascript:;" attr-model="goodsclass" attr-id="{$data.id}" attr-field="isnav" attr-val="0"  class="badge badge-secondary Fast_Action">禁用</a>
									{/eq}
								</td>
								<td title="{$data.posttime|date="Y-m-d H:i:s",###}"><span class="badge badge-primary">{$data.posttime|date="m-d H:i",###}</span></td>
								<td>									
									<a href="javascript:;" class="btn btn-primary edit_btn" attr-id="{$data.id}" data-toggle="modal" data-target="#new_box">修改</a>
									<a href="javascript:;" class="btn btn-primary add_sub_btn" attr-id="{$data.id}" data-toggle="modal" data-target="#new_box">创建子栏目</a>
									<a href="javascript:;" class="btn btn-danger Fast_Del" attr-id="{$data.id}" attr-msg="您确认删除此栏目及子栏目？" attr-model="goodsclass">删除</a>
								</td>
							</tr>
							{/volist}
						</tbody>
					</table>
                </form>
				</div>
				<!-- end table-responsive-->
			</div>
			<!-- end card body-->
		</div>
		<!-- end card -->
	</div>
	<!-- end col-->
</div>
<!-- END PAGE CONTENT-->
{/block}
{block name="modal_dig"}
<!-- Modal -->
<div class="modal fade" id="new_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-full-700">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title dig_title" id="myModalLabel"></h4>
		<button type="button" class="close" data-dismiss="modal">x</button>
      </div>
      <div class="modal-body">
            <form action="#" class="form-horizontal" id="edit_goodsclass_frm">
            	<input type="hidden" name="id" value="" />
                <div class="form-group row mb-1">
                    <label class="col-3 col-form-label">选择所属产品栏目：</label>
                    <div class="col-5">
                        <select class="form-control" tabindex="1" name="parent">
                            <option value="0">══顶级分类══</option>
                            {$cats_tree}
                        </select>
                    </div>
                </div>
                <div class="form-group row mb-1">
                    <label class="col-3 col-form-label">产品栏目名称：</label>
                    <div class="col-5">
                        <input type="text" name="classname" placeholder="请输入产品栏目名称" class="form-control  ipt_check" data-type="name" data-len="2-20" nullmsg="产品栏目名称不能为空" errormsg="产品栏目名称只能由2到20位的字母、汉字组成">
                        <span class="font-13 text-muted"></span>
                    </div>
                </div>
                <div class="form-group row mb-1">
                    <label class="col-3 col-form-label">产品栏目描述：</label>
                    <div class="col-5">
                        <textarea class="large form-control" rows="5" name="description" placeholder="请输入产品栏目描述"></textarea>
                        <span class="font-13 text-muted"></span>
                    </div>
                </div>                
                <div class="form-group row mb-1">
                    <label class="col-3 col-form-label">产品栏目图片：</label>
                    <div class="col-5 faceupload_box">
	                    <div class="picurl_upload" data-type="upload" attr-inputname="picurl" attr-value=""  isCompress="1"></div>
                    </div>
                </div>
                <div class="form-group row mb-1">
                    <label class="col-3 col-form-label">产品栏目排序：</label>
                    <div class="col-5">
                        <input type="text" name="orderid" placeholder="请输入产品栏目排序" class="form-control  ipt_check" data-type="integer" data-len="1-4" nullmsg="产品栏目排序不能为空" errormsg="产品栏目排序只能由1到4位的整数组成" value="{$orderid}">
                        <span class="font-13 text-muted"></span>
                    </div>
                </div>   
                <div class="form-group row mb-1">
                    <label class="col-3 col-form-label">是否导航显示：</label>
                    <div class="col-5">
						<div class="custom-control custom-radio">
							<input type="radio" name="isnav" id="isnav1" class="custom-control-input" value="0" checked="checked">
							<label class="custom-control-label" for="isnav1">显示</label>
						</div>
						<div class="custom-control custom-radio">
							<input type="radio" name="isnav" id="isnav2" class="custom-control-input" value="1">
							<label class="custom-control-label" for="isnav2">不显示</label>
						</div>						
                    </div>
                </div>
                <div class="form-group row mb-1">
                    <label class="col-3 col-form-label">产品栏目状态：</label>
                    <div class="col-5">
						<div class="custom-control custom-radio">
							<input type="radio" name="status" id="status1" class="custom-control-input" value="0" checked="checked">
							<label class="custom-control-label" for="status1">启用</label>
						</div>
						<div class="custom-control custom-radio">
							<input type="radio" name="status" id="status2" class="custom-control-input" value="1">
							<label class="custom-control-label" for="status2">禁用</label>
						</div> 
                    </div>
                </div>                
            </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_goodsclass_frm" attr-model="goodsclass" attr-active="save_goodsclass" attr-callback="reload">保存</button>
      </div>
    </div>
  </div>
</div>
{/block}